home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group93c.txt / 000114_icon-group-sender _Tue Dec 14 17:42:10 1993.msg < prev    next >
Internet Message Format  |  1994-02-02  |  1KB

  1. Received: by cheltenham.cs.arizona.edu; Tue, 14 Dec 1993 17:39:55 MST
  2. Date: Tue, 14 Dec 93 17:42:10 CST
  3. From: jeffery@ringer.cs.utsa.edu (Clinton L. Jeffery)
  4. Message-Id: <9312142342.AA18337@ringer.cs.utsa.edu.sunset>
  5. To: rpereda@arizona.edu
  6. Cc: icon-group@cs.arizona.edu
  7. In-Reply-To: (Ray Erasmo Pereda's message of 3 Dec 93 10:23:49 GMT <2dn43l$9ms@optima.cs.arizona.edu>
  8. Subject: two language questions
  9. Content-Length: 681
  10. Status: R
  11. Errors-To: icon-group-errors@cs.arizona.edu
  12.  
  13.  
  14.    gmt@CS.Arizona.EDU (Gregg Townsend) writes:
  15.    |> It is safe to insert and delete items of a set while the set
  16.    |> is being generated. Items that are neither inserted nor deleted are
  17.    |> generated exactly once.
  18.  
  19.    To which Ray Pereda asks:
  20.    Does the same hold for lists and tables?
  21.  
  22. No and yes.  Tables share the implementation of sets and exhibit
  23. similar behavior.  Watch what happens when you delete already-generated
  24. elements from a list during the middle of generation:
  25.  
  26. procedure main()
  27.    L := [1, 2, 3, 4]
  28.    every e := !L do { pop(L); pop(L); write(e) }
  29. end
  30.  
  31. writes:
  32.  
  33. 1
  34. 4
  35.  
  36. My, how interesting!  It gets wilder when you delete lots of elements
  37. from larger lists.
  38.